Skip to content

[Split 2/3] Add io.ably.pubsub:device and :server door packages with side-declaring agents - #1233

Draft
umair-ably wants to merge 1 commit into
integration/split-1-core-modulesfrom
integration/split-2-door-packages
Draft

[Split 2/3] Add io.ably.pubsub:device and :server door packages with side-declaring agents#1233
umair-ably wants to merge 1 commit into
integration/split-1-core-modulesfrom
integration/split-2-door-packages

Conversation

@umair-ably

Copy link
Copy Markdown

Second PR in the PDR-091b split stack (stacked on #1232; diff shows only this PR's changes). Reference: ably-js#2293, whose packages/shared/side.ts contract this ports.

What this PR does

  • io.ably.pubsub:server (jar → depends on :core): PubSubServer.httpClientBuilder(...) / PubSubServer.realtimeClientBuilder(...), per the door names agreed in PDR-091b2. Builders accept everything the core constructors accept (ClientOptions, API key string, token string — reusing the core's colon-rule disambiguation) and stamp the side at build().
  • io.ably.pubsub:device (aar → depends on :core-android): PubSubDevice.clientBuilder(...) — one door, per PDR-091 (device-side connectionless ops stay available on the one client).
  • Side-agent contract in a shared source dir (shared/, compiled into both door artifacts, not published — the Java analogue of ably-js's packages/shared/side.ts):
    • identifiers ably-pubsub-device / ably-pubsub-server, with the load-bearing-suffix warning comment (the -server suffix is what earns the MAU exemption on API-key auth);
    • caller agents entries preserved; the side entry is applied last and cannot be overridden; the caller's ClientOptions is never mutated; null passes through to the core's own initialization error.
    • The core keeps its ably-java/<version> base identifier — unchanged, already in the ably-common registry.
  • Fixes ClientOptions.copy(), which silently dropped headers, fallbackHosts, transportParams and agents. The doors rely on copy() for non-mutating stamping; the pre-existing internal callers of copy() also benefit. Unit-tested.

Tests (what billing reads — they fail loudly)

  • server: unit tests for stamping/preservation/override/no-mutation/null, plus a wire-level test that spins a local HTTP server and asserts the actual Ably-Agent header contains ably-pubsub-server/2.0.0 and ably-java/. Runs in check.yml via the existing unqualified runUnitTests invocation.
  • device: instrumentation tests asserting the same contract, added to the emulate.yml matrix (:device:connectedAndroidTest).

Open items flagged for review

  • ably-pubsub-device / ably-pubsub-server are not yet in the ably-common agents registry (checked protocol/agents.json on main, 2026-09-01) — needs an ably-common PR before any release; identifiers here match the ably-js branch exactly.
  • Builder surface is deliberately minimal (no fluent option setters yet) pending sign-off on the door surface with the chat-kotlin owner.
  • Both door artifacts bundle an identical io.ably.pubsub.internal.Side class — same pattern as the existing lib/ source shared between the two cores; harmless if both artifacts ever meet on a classpath.

🤖 Generated with Claude Code

Adds the two public artifacts of the PDR-091b split, following the
ably-js reference implementation (ably-js#2293):

- io.ably.pubsub:server (jar, on :core): PubSubServer.httpClientBuilder()
  and PubSubServer.realtimeClientBuilder(), each accepting everything the
  core constructors accept (ClientOptions, API key or token string).
- io.ably.pubsub:device (aar, on :core-android): PubSubDevice.clientBuilder(),
  one door per PDR-091.
- A shared side helper (shared/src/main/java, compiled into both door
  artifacts rather than published) owns the ably-pubsub-device and
  ably-pubsub-server agent identifiers and the stamping rules: caller
  entries preserved, side entry applied last and unoverridable, caller's
  options never mutated, null passing through to the core's own error.
  The -device/-server suffixes are load-bearing for MAU billing
  classification and documented as such.
- Fixes ClientOptions.copy() to carry headers, fallbackHosts,
  transportParams and agents, which it previously dropped; the doors rely
  on copy() for non-mutating stamping. Covered by a new unit test.
- Server tests include a wire-level assertion that the Ably-Agent HTTP
  header carries ably-pubsub-server/<version> alongside the ably-java
  base identifier; device instrumentation tests assert the same contract
  and run in the emulator matrix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
umair-ably added a commit to ably/ably-common that referenced this pull request Sep 1, 2026
PDR-091b splits every Pub/Sub SDK into per-side packages whose
factories stamp a side-declaring agent entry so that MAU
classification never has to guess which side a connection is on. The
identifiers are shared across languages: ably/ably-js#2293,
ably/ably-java#1233 and ably/ably-ruby#453 all stamp the same
ably-pubsub-device / ably-pubsub-server strings, each with its own
package version, alongside the SDK's own agent entry.

Register both identifiers so the realtime system classifies them as
known agents rather than by their -device/-server suffix alone. Names
are language-neutral because the identifiers are.

The schema requires a single source repository for wrapper-type
agents, but these are the registry's first multi-repo identifiers;
ably-js is given as the first publisher, with the caveat noted in the
PR that fetch-agent-releases will attribute all stamped versions to
ably-js releases until the schema can express multiple sources.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant